#include <cstdlib>
#include <iostream>

#include "Class/Manager/Scene.hpp"

#include "Function/Main.hpp"
#include "Function/Static.hpp"

#include "Template/Manager/Memory.hpp"

int	main(void)
{
  bool	ret = false;

  try
    {
	  Manager::Graphics::Configuration	Config;
	  Config.Width(1024);
	  Config.Height(203);
	  Config.Color(8);
	  Config.Caption("LOL");
	  Config.Windowed(true);
	  Config.Framerate(60);
	  Config.VSync(false);
	  Config.OpenGL(true);

	  Manager::Graphics					GraphicsManager;
	  GraphicsManager.SetConfiguration(Config);
	  GraphicsManager.SetBackgroundColor(0, 0, 0);

	  Manager::Scene					SceneManager(GraphicsManager);
	  ret = SceneManager.Run();
	}

  catch (std::string const &e)
    {
      std::cerr << "An unhandled error occured." << std::endl
				<< "\t[ERROR]: " << e << std::endl;
    }
  catch (...)
    {
      std::cerr << "An uncaught error occured." << std::endl;
    }

  DeleteSingletons();

  return (ret ? EXIT_SUCCESS : EXIT_FAILURE);
}
